1 /* Copyright 2006-2011 The MathWorks, Inc. */
2
3 /*
4 * File: sil_main.c
5 *
6 * SIL main
7 *
8 */
9 #include "xil_interface_lib.h"
10
11 int main(const int argc, char * argv[]) {
12 XIL_INTERFACE_LIB_ERROR_CODE errorCode = XIL_INTERFACE_LIB_SUCCESS;
13 /* avoid warnings about infinite loops */
14 volatile int loop = 1;
15
16 /* XIL initialization */
17 errorCode = xilInit(argc, (void **) argv);
18 if (errorCode != XIL_INTERFACE_LIB_SUCCESS) {
19 /* terminate application */
20 return errorCode;
21 }
22 /* main XIL loop */
23 while(loop) {
24 errorCode = xilRun();
25 if (errorCode != XIL_INTERFACE_LIB_SUCCESS) {
26 if (errorCode == XIL_INTERFACE_LIB_TERMINATE) {
27 int exitCode;
28 /* orderly shutdown of rtiostream */
29 exitCode = xilTerminateComms();
30 if (exitCode == XIL_INTERFACE_LIB_SUCCESS) {
31 exitCode = 0;
32 }
33 /* terminate */
34 return exitCode;
35 } else {
36 /* terminate with error code */
37 return errorCode;
38 }
39 }
40 }
41 return errorCode;
42 }
43
|